package algotithm.interview.gensheixueGo.test4;

import java.io.*;

/**
 * @author zhouyanxiang
 * @Date 2021-04-2021/4/15-16:10
 */
public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

        int n = Integer.parseInt(reader.readLine());
        int[][] arr = new int[n][n];
        int idx = 0;
        int t = n;
        while (t-- > 0) {
            String[] str = reader.readLine().split(" ");
            for (int i = 0; i < n; i++) {
                arr[idx][i] = Integer.parseInt(str[i]);
            }
            idx++;
        }
        test(arr);
        test(arr);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                writer.write(arr[i][j] + " ");
            }
            writer.write("\n");
        }
        writer.flush();
        writer.close();
        reader.close();
    }

    public static void test(int[][] arr) {
        int n = arr.length;
        for (int i = 0; i < n / 2 ; i++) {
            for (int j = 0; j < (n + 1)/ 2; j++) {
                int tmp = arr[i][j];
                arr[i][j] = arr[n - j - 1][i];
                arr[n - j - 1][i] = arr[n - i - 1][n - j - 1];
                arr[n - i - 1][n - j - 1] = arr[j][n - i - 1];
                arr[j][n - i - 1] = tmp;
            }
        }
    }

}
